<?php 
require_once("../../includes/_ClsCon.php");
$db = new MySQLi('localhost','root','12345','notarios');
$_obj   = new _ClsCon();     
	
	$estado					= $_POST['estado'];
	$numformu 				= $_REQUEST['numformu'];
	$solicitantec 			= $_REQUEST['solicitantec'];
	$rangocc1				= $_REQUEST['rangocc1'];
	$rangocc2 	 			= $_REQUEST['rangocc2'];

	$db = new MySQLi('localhost','root','12345','notarios');
	$limite				= $_POST['limite'];

	$query2 = "SELECT id_cambio FROM cambio_caracter";
	$res2=$db->query($query2);
	$total=$res2->num_rows;
	
	$paginas=ceil($total/17);
	
    $query = "CALL spLisCambios('".$numformu."' ,'".$solicitantec."' ,'".$rangocc1."' ,'".$rangocc2."','".$estado."',".$limite.")";
	
	$res=$db->query($query);
	//var_dump($consulta_poderes);
	//exit();
if($res2->num_rows){	

while ($rowkar = $res->fetch_array())
{	

	$nomyape=strtoupper($rowkar['descri_solicitante']);
	$textorefe=str_replace("?","'",$nomyape);
	$textoampers=str_replace("*","&",$textorefe);
	$textoamperss=str_replace("ñ","Ñ",$textoampers);
	$refii=strtoupper($textoamperss);

	$numcrono = $rowkar['num_crono'];
	$numrono2 = substr($numcrono,5,6).'-'.substr($numcrono,0,4);

	$fecha = $rowkar['fec_ingreso'];
	$fecha1 = explode ("-",$fecha);
	$fecha2 = $fecha1[2] . "/" . $fecha1[1] . "/" . $fecha1[0];

$cambiocaracteristicas[$rowkar['id_cambio']]=  "<table width='880' border='1' cellpadding='0' cellspacing='0' bordercolor='#333333' >
  <tr>
    <td width='63' align='center' ><span class='reskar'><a href='editCambioCaracVie.php?num_crono=".$rowkar['num_crono']."&id=".$rowkar['id_cambio']."'>".$numrono2."</a></span></td>
	<td width='86' align='center' ><span class='reskar'>".$fecha2."</span></td>
	<td width='70' align='center' ><span class='reskar'>".$rowkar['num_formu']."</span></td>
    <td width='200' align='center'><span class='reskar'>".$refii."</span></td>
  </tr>
</table>";
}
}


foreach($cambiocaracteristicas as $cambio){
	
	echo "<article >".$cambio."</article>";
	}		

echo "<table width='300' border='0' cellspacing='0'cellpadding='0'>
  <tr>
    <td width='45'>"; if ($limite>0){
	
	$limit=$limite-17;
	echo "<input type='hidden' value='".$limit."' id='_imagen' /><aside onClick=\"cargakardex(".$limit.")\"><img src='../../ante.png' width='37' height='36' border='0' title='Anterior'></aside>";
	
	}else{
		echo "<input type='hidden' value='".$limit."' id='_imagen' /><aside></aside>";
		}  echo"</td>
    		<td width='100'>";
			echo "total de pag :"." ".$paginas;
			echo"</td>
    <td width='50'>"; 
	
	if ($limite<$total-17){
	
	$limit=$limite+17;
	echo "<aside onClick=\"cargakardex(".$limit.")\"><img  src='../../sigte.png' width='37' height='36' border='0' title='Siguiente'></aside>";
	
	}else{
		echo "<aside></aside>";
		}
	
	echo"</td>
  </tr>
</table>";
?>